//
//  Seach_FiltrateBrand_CollectionViewCell_WX.m
//  ZITHER
//
//  Created by weixin on 2019/3/20.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Seach_FiltrateBrand_CollectionViewCell_WX.h"

@implementation Seach_FiltrateBrand_CollectionViewCell_WX

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = RandomColor;
        [self addSubview:self.TB];

        [self.TB mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self).offset(0);
//            make.height.mas_equalTo(kScreenH-NaviHeight-40-100-kBottomSafeHeight);
        }];

    }
    return self;
}

- (Seach_FiltrateBrand_Tbv_WX *)TB{
    if (_TB) {
        return _TB;
    }
    _TB = [[Seach_FiltrateBrand_Tbv_WX alloc]initializeFrame:CGRectMake(0, 0, 1, 1) isMj:0 isEstimatedRowHeight:NO addRegisterNib:@[@"MainSeachBrandCell",@"MainSeachBCell",@"Seach_FiltrateBrand_CellWX"]];

    return _TB;
}


//-(void)reloadDataTB:(NSInteger)index location:(bool)location
//{
//
//    NSLog(@"刷新 == index == %ld ",index);
//
//    NSDictionary*dic = self.arrTitle [index];
//
//    //    NSMutableArray *arrM = [self setdic:[NSString stringWithFormat:@"%ld",index]];
//    NSLog(@"TB = 内存地址 %p",self.TB);
//    //上啦刷新
//    [BaseDataM loadDataAPIGN:dic[@"ncid"] succeed:^(id obj) {
//
//        NSMutableArray *arrMNew = obj;
//
//        if (location) {
//            [self.TB.mj_footer endRefreshing];
//            if (arrMNew.count==0) {
//                return ;
//            }
//            NSLog(@"TB = 内存地址 %p",self.TB);
//            //从后面添加数据
//
//            [self.TB.arrM addObjectsFromArray:arrMNew];
//
//            [self closeRefreshing:index arrM:self.TB.arrM];
//
//            //            [self.dicM setValue:arrM forKey:[NSString stringWithFormat:@"%ld",index]];
//
//        }else{
//            [self.TB.mj_header endRefreshing];
//            if (arrMNew.count==0) {
//                return ;
//            }
//            NSArray *arr1 = [NSArray arrayWithArray:self.TB.arrM];
//
//            //从前添加数据
//            [arrMNew addObjectsFromArray:arr1];
//
//            //            [self.dicM setValue:arrMNew forKey:[NSString stringWithFormat:@"%ld",index]];
//            [self closeRefreshing:index arrM:arrMNew];
//        }
//
//    } error:^(id error) {
//        [self closeRefreshing:index arrM:nil];
//    }];
//
//}

-(void)closeRefreshing:(NSInteger)index arrM:(NSMutableArray*)arrM
{
    //    self.TB.arrM = arrM;
    
    NSLog(@"%p",_arrM);
    //掉出去
    
    
    
    if (self.blcok) {
        _blcok(index,arrM);
    }
    //    [self.TB reloadData];
    
    //    NSIndexPath *newPath = [NSIndexPath indexPathForRow:index inSection:0];
    
    //    UICollectionViewCell *nextCell = [self cellForItemAtIndexPath:newPath];
    
    //    WxFirstTbV *TB = (WxFirstTbV*)[nextCell viewWithTag:index+100];
    
    //    NSLog(@"arrM.count = %ld",arrM.count);
    
}

-(void)setIndexBox:(NSInteger)indexBox
{
    _indexBox = indexBox;
}

-(void)setArrTitle:(NSMutableArray *)arrTitle
{
    _arrTitle = arrTitle;
    NSLog(@"%p,%p",_arrTitle,arrTitle);
    //    NSLog(@"");
}

-(void)setArrM:(NSMutableArray *)arrM
{
    _arrM = arrM;
    NSLog(@"%p,%p",_arrM,arrM);
    //    NSLog(@"");
}

@end
